@extends('pc_admin.app')
@section('content')
    <link rel="stylesheet" href="/css/pc-system/attendance-left.css">
    <link rel="stylesheet" href="/css/pc-system/attendance-setting.css">
    <div class="mian-container">
        <div class="container-section attendance-setting">
            @include(('pc_admin.attendance_left'))
            <div class="right-section">
                <div class="float-section absence-section">
                    <div class="middle-section">
                        <p>缺勤</p><p>对应分值</p>
                        <div class="input-div">
                            <input class="weui-input" type="text" value="迟到">
                            <input class="sub-num weui-input"   type="text"  value="{{$set->late}}"  name="late">
                        </div>
                        <div class="input-div">
                            <input class="weui-input" type="text" value="早退">
                            <input class="sub-num weui-input" type="text" value="{{$set->early}}" name="early">
                        </div>
                        <div class="input-div">
                            <input class="weui-input" type="text" value="旷工">
                            <input class="sub-num weui-input" type="text" value="{{$set->absenteeism}}" name="absenteeism">
                        </div>
                        <div class="input-div">
                            <input class="weui-input" type="text" value="事假">
                            <input class="sub-num weui-input" type="text" value="{{$set->business}}" name="business">
                        </div>
                        <div class="input-div">
                            <input class="weui-input" type="text" value="病假">
                            <input class="sub-num weui-input" type="text" value="{{$set->sick}}" name="sick">
                        </div>
                    </div>
                </div>
                <div class="float-section overtime-section">
                    <div class="middle-section">
                        <p>加班时间</p><p>对应分值</p>
                        <div class="input-div">
                            <p class="weui-input" style="width: 120px; color: #434343;margin-left: 0px;margin-right: 0px;padding-left: 35px;">1小时</p>
                            <input class="sub-num weui-input" type="text" value="{{$set->overtime}}" name="overtime">
                        </div>
                    </div>
                </div>
                <a href="javascript:void (0);" class="weui-btn weui-btn_color" id="smt" onclick="ajax_set_update()">确定</a>
            </div>
        </div>
    </div>
    <script>
        $(document).ready(function () {
            if($('.left-section').height()<$('.right-section').height()){
                $('.left-section').css('min-height',$('.right-section').height())
            }else{
                $('.right-section').css('min-height',$('.left-section').height());
            }
            $.ajaxSetup({
                headers: {
                    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                }
            });
            function ajax_set_update() {
                var url='/admin/set/attendance_update';
                var late = $('input[name|="late"]').val();
                var early = $('input[name|="early"]').val();
                var absenteeism = $('input[name|="absenteeism"]').val();
                var business = $('input[name|="business"]').val();
                var sick = $('input[name|="sick"]').val();
                var overtime = $('input[name|="overtime"]').val();
                $.ajax({
                    type: 'put',
                    cache: 'false',
                    url: url,
                    data: 'late=' + late + '&early=' + early+ '&absenteeism=' + absenteeism+ '&business=' + business+ '&sick=' + sick+ '&overtime=' + overtime,
                    dataType: 'json',
                    success: function (data) {
                        if (data.status == 'success') {
                            layer.msg(data.msg, {icon: 1});
                        } else {
                            layer.msg(data.msg, {icon: 2});
                            window.location.href= data.redirectUrl;
                        }
                    },
                    error: function () {
                        layer.msg('网络异常请重试', {icon: 2});
                    }
                });
            }
            $('.title-list.top-list').addClass('active');
            $('.head_kaoqin').addClass('active');
        })
    </script>
@endsection


















